'''
常用的元素操作的方法：
(1)clear()				清除文本
(2)send_keys(*value)		模拟按键输入
(3)click()				点击元素
(4)submit				提交表单
(5)text					获取元素的文本
(6)get_attribute(name)		获取属性值
(7)is_displayed()			设置该元素是否用户可见


'''

from selenium import webdriver
from selenium.webdriver.common.by import By
from time import sleep
from options import options


driver = webdriver.Chrome(options=options)
driver.get(r'https://www.baidu.com/')
sleep(1)

# driver.find_element(By.ID,'kw').clear()
# driver.find_element(By.ID,'kw').send_keys('aaaa')
# driver.find_element(By.ID,'kw').submit()
# sleep(1)


text = driver.find_element(By.XPATH, '//*[@id="bottom_layer"]/div/p[6]/a').text
print(text)

href = driver.find_element(By.XPATH, '//*[@id="bottom_layer"]/div/p[6]/a').get_attribute('href')
print(href)

is_displayed = driver.find_element(By.XPATH, '//*[@id="bottom_layer"]/div/p[6]/a').is_displayed()
print(is_displayed)

driver.quit()
